﻿Public Class frmMain

    Private EmployeeData As Employee
    Private EmployeeInfo As EmployeeInfo
  
   
    Private Sub mnuExit_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles mnuExit.Click
        Me.Close()

    End Sub
    Private Sub SSSTableToolStripMenuItem_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles SSSTableToolStripMenuItem.Click
        Dim frmSSSBR As frmSSSBR = New frmSSSBR
        frmSSSBR.WindowState = FormWindowState.Normal
        frmSSSBR.Show()
        frmSSSBR.MdiParent = Me
    End Sub
    Private Sub PagIBIGTableToolStripMenuItem_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles PagIBIGTableToolStripMenuItem.Click
        frmPagIBIGBR.WindowState = FormWindowState.Normal
        frmPagIBIGBR.Show()
        frmPagIBIGBR.MdiParent = Me
    End Sub

    Private Sub PHILHEALTHTableToolStripMenuItem_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles PHILHEALTHTableToolStripMenuItem.Click
        frmPHIBR.WindowState = FormWindowState.Normal
        frmPHIBR.Show()
        frmPHIBR.MdiParent = Me
    End Sub

    Private Sub TaxTableToolStripMenuItem_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles TaxTableToolStripMenuItem.Click
        frmTaxBR.WindowState = FormWindowState.Normal
        frmTaxBR.Show()
        frmTaxBR.MdiParent = Me
    End Sub
    Private Sub TaxCodeToolStripMenuItem_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles TaxCodeToolStripMenuItem.Click
        frmTaxCodeBR.WindowState = FormWindowState.Normal
        frmTaxCodeBR.Show()
        frmTaxCodeBR.MdiParent = Me
    End Sub
    Private Sub ManageHolidaysToolStripMenuItem_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles ManageHolidaysToolStripMenuItem.Click
        frmHolidayBR.WindowState = FormWindowState.Normal
        frmHolidayBR.Show()
        frmHolidayBR.MdiParent = Me
    End Sub

    Private Sub mnuHelp_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles mnuHelp.Click
        'SQLValidator.Show()
        'SQLValidator.MdiParent = Me
    End Sub

    Private Sub mnuAbout_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles mnuAbout.Click
        aboutform.Show()
        aboutform.MdiParent = Me
    End Sub

    Private Sub frmMain_FormClosing(ByVal sender As Object, ByVal e As System.Windows.Forms.FormClosingEventArgs) Handles Me.FormClosing
        If MessageBox.Show("Are you sure you want to close this application?", _
                "Confirm System Shutdown", MessageBoxButtons.YesNo) = Windows.Forms.DialogResult.No Then
            e.Cancel = True
        Else
            End
        End If
    End Sub


  
   

   
    Private Sub BackToDTRPageToolStripMenuItem_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles BackToDTRPageToolStripMenuItem.Click
        Me.Hide()
        lblLoginSuccess.Show()
    End Sub

    Private Sub mnuChangePassword_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles mnuChangePassword.Click
        MainGlobalData.mEmployee = EmployeeData
        frmAccountManageBR.Show()
        frmAccountManageBR.MdiParent = Me
    End Sub

    Private Sub frmMain_VisibleChanged(ByVal sender As Object, ByVal e As System.EventArgs) Handles Me.VisibleChanged
        If Me.Visible = True Then
            EmployeeData = MainGlobalData.mEmployee
            EmployeeInfo = MainGlobalData.mEmployeeInfo
            If EmployeeData.role = "0" Then
                ManageLeavesToolStripMenuItem.Visible = False
                ManageOvertimesToolStripMenuItem.Visible = False
                ManageEmployeesToolStripMenuItem1.Visible = False
                mnuPayroll.Visible = False
                ToolStripSeparator3.Visible = False
            Else
                ManageLeavesToolStripMenuItem.Visible = True
                ManageOvertimesToolStripMenuItem.Visible = True
                ManageEmployeesToolStripMenuItem1.Visible = True
                mnuPayroll.Visible = True
                ToolStripSeparator3.Visible = True
            End If
            If Not EmployeeInfo Is Nothing Then
                ToolStripStatusLabel1.Text = EmployeeInfo.last_name & "," & EmployeeInfo.first_name
            End If

            
        Else

        End If
    End Sub

    Private Sub ManageEmployeesToolStripMenuItem1_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles ManageEmployeesToolStripMenuItem1.Click
        frmManageEmployeesBR.Show()
        frmManageEmployeesBR.MdiParent = Me
    End Sub

    Private Sub VacationLeaveToolStripMenuItem_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles VacationLeaveToolStripMenuItem.Click
        MainGlobalData.mEmployee = EmployeeData
        MainGlobalData.mleavetype = "Vacation Leave"

        Dim lvFrm As New frmLeaveBR("vacation", EmployeeData, 0)
        lvFrm.Show()
        lvFrm.MdiParent = Me
    End Sub

    Private Sub SickLeaveToolStripMenuItem_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles SickLeaveToolStripMenuItem.Click
        MainGlobalData.mEmployee = EmployeeData
        MainGlobalData.mleavetype = "Sick Leave"
        Dim lvFrm As New frmLeaveBR("sick", EmployeeData, 0)
        lvFrm.Show()
        lvFrm.MdiParent = Me
    End Sub

    Private Sub mnuDTR_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles mnuDTR.Click
        Dim frmAttendance As New frmDTR(EmployeeData)
        frmAttendance.Show()
        frmAttendance.MdiParent = Me
    End Sub

    Private Sub mnuOvertimeForm_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles mnuOvertimeForm.Click
        Dim frmOT As New frmOvertimeBR(EmployeeData, 0)
        frmOT.Show()
        frmOT.MdiParent = Me
    End Sub

    Private Sub mnuPayrollComputation_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles mnuPayrollComputation.Click
        Dim formPayroll As New frmPayroll(EmployeeData)
        formPayroll.Show()
        formPayroll.MdiParent = Me
       
    End Sub

    Private Sub mnuPayslip_Click(sender As System.Object, e As System.EventArgs) Handles mnuPayslip.Click
        Dim frmPayslip As New frmPayslip(EmployeeData)
        frmPayslip.Show()
        frmPayslip.MdiParent = Me
    End Sub

    Private Sub ManageLeavesToolStripMenuItem_Click(sender As System.Object, e As System.EventArgs) Handles ManageLeavesToolStripMenuItem.Click
        Dim lvFrm As New frmLeaveBR("", EmployeeData, 1)
        lvFrm.Show()
        lvFrm.MdiParent = Me
    End Sub

    Private Sub ManageOvertimesToolStripMenuItem_Click(sender As System.Object, e As System.EventArgs) Handles ManageOvertimesToolStripMenuItem.Click
        Dim frmOT As New frmOvertimeBR(EmployeeData, 1)
        frmOT.Show()
        frmOT.MdiParent = Me
    End Sub

  
    Private Sub frmMain_Load(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles MyBase.Load

    End Sub
End Class
